package com.zenagro.actions.crud;

import java.io.*;
import java.util.*;

import javax.inject.*;

import org.openxava.actions.*;
import org.openxava.model.*;
import org.openxava.util.*;

import com.zenagro.utils.*;

public class DeleteFileAction extends DeleteAction{
	
	@Inject
	HashMap mapaComun;
	
	public void execute() throws Exception {
		FileEntityUtils feu=new FileEntityUtils(getView(),mapaComun);
		String file=feu.getFileName();
		super.execute();
		if(file!=null)
			Files.deleteDir(feu.pathRepo+File.separator+getView().getModelName()+File.separator+file.substring(0,file.lastIndexOf(File.separator)));

	}

}
